<template>
  <cube-scroll ref="scroll" class="ratings" :options="scrollOptions">
    <div v-show="isShow" class="ratings-content" >
      <div class="overview"
        v-for="(merchant,index) in computedMerchants"
        :key="index"
      >
        <div class="overview-left">
          <div>{{merchant.name}}</div>
          <div class="rank">{{merchant.desc}}</div>
          <div class="avatar">
            <img width="32" height="32" :src="merchant.img">
          </div>
        </div>
        <div class="overview-right">
          <div class="score-wrapper">
            <span class="title">QQ</span>
            <p class="score">{{merchant.qq}}</p>
          </div>
		  <div class="score-wrapper">
            <span class="title">保证金</span>
            <p class="score">{{merchant.deposit}}</p>
          </div>
          <div class="score-wrapper">
            <span class="title">充值费率</span>
            <span class="score">{{merchant.deposit_fee}}%</span>
          </div>
        </div>
      </div>
      <split></split>
    </div>
    <div v-show = "notisShow" class="ratings-content">
        <div>
            <span class="title">承兑商</span>
            <span class="delivery">{{nowmerchant.merchant_name}}</span>
        </div>
        <div>
            <span class="title">平台可用保证金</span>
            <span class="delivery">{{nowmerchant.escrow_availabe_amount}}</span>
        </div>
          <div class="score-wrapper">
            <span class="score">费率 {{(nowmerchant.merchant_recharge_rate + 5 )/100}}%</span>
          </div>
        <div>
            <span class="title">可充值最小额度</span>
            <span class="delivery">{{nowmerchant.recharge_floorlimit}}</span>
        </div>
        <div>
            <span class="title">可充值最大额度</span>
            <span class="delivery">{{nowmerchant.recharge_limit}}</span>
        </div>
        <div>
            <span class="title">充值金额</span>
            <span class="delivery">{{nowmerchant.escrow_availabe_amount}}</span>
        </div>
        <div>
            <span class="title">联系电话</span>
            <span class="delivery">{{nowmerchant.escrow_availabe_amount}}</span>
        </div>
    </div>
  </cube-scroll>
</template>

<script>
  import Star from 'components/star/star'
  import RatingSelect from 'components/rating-select/rating-select'
  import Split from 'components/split/split'
  import ratingMixin from 'common/mixins/rating'
  import { getMerchants, getRatings } from 'api'
  import moment from 'moment'
  import axios from 'axios'

  export default {
    name: 'ratings',
    mixins: [ratingMixin],
    props: {
      data: {
        type: Object
      }
    },
    data () {
      return {
        isShow:true,
        notisShow:false,
        datamerchants: [{
		"id": "1",
		"name": "桂梅秒兌",
		"qq": "102571063",
		"desc": "承兑秒冲值得信任",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/03bb6061276f5e88441780621964a396.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "1",
		"time": "2018-03-26 10:22:10"
	}, {
		"id": "2",
		"name": "布丁速兑",
		"qq": "2189709392",
		"desc": "老牌知名承兑商竭诚为您服务",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/349cb63140e78b11608fbaa25efbae65.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "1",
		"time": "2018-03-26 13:01:08"
	}, {
		"id": "3",
		"name": "CNC-搬砖小林",
		"qq": "2560647",
		"desc": "你币圈忠实的服务商",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/cb360987a9385f6e2f831c4b160d250b.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"30000 CNC",
		"bitcny_acceptant": "1",
		"time": "2018-03-26 13:59:16"
	}, {
		"id": "5",
		"name": "天天快兑",
		"qq": "2667243903",
		"desc": "支持支付宝、网银专业快捷 ",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/0dd79b621a2176f98e73dd13b04b4ae9.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"20000 CNC",
		"bitcny_acceptant": "1",
		"time": "2018-03-26 14:46:30"
	}, {
		"id": "6",
		"name": "小艾",
		"qq": "25610409 ",
		"desc": "梦想必须得有，万一实现了呢",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/97860e32ad44d833404ca7975c161f5f.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"20000 CNC",
		"bitcny_acceptant": "1",
		"time": "2018-03-26 14:47:53"
	}, {
		"id": "7",
		"name": "时代极速承兑",
		"qq": "198890389",
		"desc": "有问必答极速充提",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/37689baef781d3b6ecb3e1dc2192c111.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 16:19:02"
	}, {
		"id": "8",
		"name": "财富宝宝",
		"qq": "4003932",
		"desc": "安全稳定及时的财富助手",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/3def14c63f93f38a32bfff8cdae33978.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 16:20:23"
	}, {
		"id": "10",
		"name": "车厘子小公举",
		"qq": "3090977124",
		"desc": "每天元气满满地给你承兑喔",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/ff5557b14f8a00380c0ab00a099c1352.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 16:49:01"
	}, {
		"id": "12",
		"name": "小歪歪嘴-速兑",
		"qq": "88408282",
		"desc": "在线-支付宝银行卡快速承兑",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/1005eed39d4fe1b89df165d4b2cbb7fd.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 17:06:10"
	}, {
		"id": "13",
		"name": "聪哥秒兑",
		"qq": "584818438",
		"desc": "在线下单极速到账",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/0d324dcc16f80e9be81a2a7ab07d8a3d.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 17:10:04"
	}, {
		"id": "14",
		"name": "塔点",
		"qq": "2623178306",
		"desc": "诚信充提，快速处理",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/f720ce19c2cb646ab39f841a09bac796.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 17:13:39"
	}, {
		"id": "15",
		"name": "小苹果快兑",
		"qq": "1563703147",
		"desc": "*屏蔽的关键字*充提，支付宝\/银行卡",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/d7e91ddb0c6353a1675ecadc5e94e81e.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 17:20:02"
	}, {
		"id": "16",
		"name": "小怪兽",
		"qq": "3437389686",
		"desc": "欢迎联系小怪兽充提",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/5d60979ea1b9bb4d11188addf730c566.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 17:21:01"
	}, {
		"id": "17",
		"name": "神风承兑",
		"qq": "3478621684",
		"desc": "良心承兑，吐血服务",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/468fd2f2faa06164d4ca41ecbd1c3218.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 17:25:51"
	}, {
		"id": "18",
		"name": "九哥助理",
		"qq": "454575708",
		"desc": "快速到账,支付宝\/银行卡\/",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/35e4229cf44295c2657b0dd09f4d00ee.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 17:29:03"
	}, {
		"id": "19",
		"name": "文哥承兑",
		"qq": "5302150",
		"desc": "极速承兑安全可靠喔",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/6272125afe97afe8fff90047d668e70e.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 17:30:12"
	}, {
		"id": "20",
		"name": "ToBe区块链",
		"qq": "2179769430",
		"desc": "安全快速专业USDT",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/a4df9285fda641dc2893f9df5b3d1e32.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 17:34:51"
	}, {
		"id": "21",
		"name": "萌妹女神",
		"qq": "471297013",
		"desc": "女神只想带你给好运！",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/c97a0d6d44084b2e93b55c0f7dded78a.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 17:42:08"
	}, {
		"id": "22",
		"name": "蘇巴黎",
		"qq": "185792208",
		"desc": "在线-极速秒处理",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/514bd7e731dc980d6e57523063a0bce2.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 17:43:11"
	}, {
		"id": "23",
		"name": "闪电承兑",
		"qq": "3165931920",
		"desc": "快速承兑，服务你我",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/23bb6dd4ce879ca720ae157ed0d415c0.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 18:02:05"
	}, {
		"id": "24",
		"name": "比特股宝宝",
		"qq": "2188379086",
		"desc": "职业承兑,安全可靠",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/985d0385dd78b6877b46262225bfba9c.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 18:04:25"
	}, {
		"id": "25",
		"name": "汇通承兑",
		"qq": "43906376",
		"desc": "快速承兑，用心服务",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/2e890b4c6357dfff70d61090d9917fc2.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 18:05:34"
	}, {
		"id": "27",
		"name": "汤米承兑(24小时)",
		"qq": "3313555930",
		"desc": "费率优势，大额充提专用",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/f3d8a301b71507797f574437bfed74ec.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 18:14:21"
	}, {
		"id": "28",
		"name": "浪子潇然",
		"qq": "425166213",
		"desc": "专注承兑，风雨无阻",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/ecd506266e16d4528ff914b4cab86df9.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-26 18:17:00"
	}, {
		"id": "100",
		"name": "实时速兑",
		"qq": "1833631908",
		"desc": "网银、支付宝、实时承兑",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/03\/2481ba013233171d12b033ee9d58b738.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-03-27 14:27:01"
	}, {
		"id": "101",
		"name": "牛头承兑",
		"qq": "2548007088",
		"desc": "银行卡 支付宝",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/04\/c52d9ce09b33b3ba6503e8117d72c412.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-04-16 11:57:02"
	}, {
		"id": "102",
		"name": "Pudge的忧伤",
		"qq": "464971281",
		"desc": "24小时在线",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/04\/670f951f2d6dee69bdf19fdc941ebad2.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-04-17 16:51:35"
	}, {
		"id": "103",
		"name": "比特潇潇速兑",
		"qq": "3088796596",
		"desc": "安全可靠，快速高效",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/05\/682a137b3671c8c47d7f16082e890ebc.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-05-08 17:15:34"
	}, {
		"id": "105",
		"name": "簡單承兌",
		"qq": "229486041",
		"desc": "24小時承兌",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/05\/6af98c4c348e9a28995568a5940e1d6a.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-05-21 17:43:06"
	}, {
		"id": "106",
		"name": "毅仔秒兑",
		"qq": "80008878",
		"desc": "20年金牌QQ实名保障",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/06\/5dfdf781593e68860dbe24088d0e765c.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-06-19 11:53:27"
	}, {
		"id": "108",
		"name": "Tik合作伙伴",
		"qq": "497751528",
		"desc": "安全，秒兑，值得信任",
		"img": "https:\/\/aexphoto-1251755124.cossgp.myqcloud.com\/img\/2018\/08\/a5740092c7d5cda25fb6a19c4e3547a5.jpg",
		"deposit_fee": "0.5",
		"withdraw_fee": "0.5",
		"deposit":"50000 CNC",
		"bitcny_acceptant": "0",
		"time": "2018-08-13 17:17:38"
	}
],
        merchants:[],
        nowmerchant:{},
        scrollOptions: {
          click: false,
          directionLockThreshold: 0
        }
      }
    },
    computed: {
      merchant () {
        return this.data.merchants || {}
      },
      seller () {
        return this.data.seller || {}
      }
    },
    methods: {
      fetch () {
        if (!this.fetched) {
          this.fetched = true
            for(var i=0 ;i< this.datamerchants.length;i++){
                if ( this.datamerchants[i]["bitcny_acceptant"] == 1 )
                    this.merchants.push(this.datamerchants[i])
            }
        }
      },
      format (time) {
        return moment(time).format('YYYY-MM-DD hh:mm')
      }
    },
    components: {
      Star,
      Split,
      RatingSelect
    },
    watch: {
      selectType () {
        this.$nextTick(() => {
          this.$refs.scroll.refresh()
        })
      }
    }
  }
</script>

<style lang="stylus" scoped>
  @import "~common/stylus/variable"
  @import "~common/stylus/mixin"

  .ratings
    position: relative
    text-align: left
    white-space: normal
    height: 100%
    .overview
      display: flex
      padding: 18px 0
      .overview-left
        flex: 0 0 170px
        padding: 6px 0
        width: 170px
        border-right: 1px solid $color-col-line
        text-align: center
        @media only screen and (max-width: 320px)
          flex: 0 0 120px
          width: 120px
        .score
          margin-bottom: 6px
          line-height: 28px
          font-size: $fontsize-small
          color: $color-orange
        .title
          margin-bottom: 8px
          line-height: 28px
          font-size: $fontsize-small
          color: $color-dark-grey
        .rank
          line-height: 28px
          font-size: $fontsize-small-s
          color: $color-light-grey
      .overview-right
        flex: 1
        padding: 6px 0 6px 24px
        @media only screen and (max-width: 320px)
          padding-left: 6px
        .score-wrapper
          display: flex
          align-items: center
          margin-bottom: 8px
          .title
            line-height: 18px
            font-size: $fontsize-small
            color: $color-dark-grey
          .score
            line-height: 18px
            margin-left: 12px
            font-size: $fontsize-medium
            color: $color-orange
        .delivery-wrapper
          display: flex
          align-items: center
          .title
            line-height: 18px
            font-size: $fontsize-small
            color: $color-dark-grey
          .delivery
            margin-left: 12px
            font-size: $fontsize-small
            color: $color-light-grey
    .rating-wrapper
      padding: 0 18px
      .rating-item
        display: flex
        padding: 18px 0
        &:last-child
          border-none()
        .avatar
          flex: 0 0 28px
          width: 28px
          margin-right: 12px
          img
            height: auto
            border-radius: 50%
        .content
          position: relative
          flex: 1
          .name
            margin-bottom: 4px
            line-height: 12px
            font-size: $fontsize-small-s
            color: $color-dark-grey
          .star-wrapper
            margin-bottom: 6px
            display: flex
            align-items: center
            .star
              margin-right: 6px
            .delivery
              font-size: $fontsize-small-s
              color: $color-light-grey
          .text
            margin-bottom: 8px
            line-height: 18px
            color: $color-dark-grey
            font-size: $fontsize-small
          .recommend
            display: flex
            align-items: center
            flex-wrap: wrap
            line-height: 16px
            .icon-thumb_up, .item
              margin: 0 8px 4px 0
              font-size: $fontsize-small-s
            .icon-thumb_up
              color: $color-blue
            .item
              padding: 0 6px
              border: 1px solid $color-row-line
              border-radius: 1px
              color: $color-light-grey
              background: $color-white
          .time
            position: absolute
            top: 0
            right: 0
            line-height: 12px
            font-size: $fontsize-small
            color: $color-light-grey
</style>
